home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Source Code
/
Libraries
/
C++ Toolbox 1.0
/
Types++.h
< prev
Wrap
C/C++ Source or Header
|
1996-03-10
|
1KB
|
45 lines
#pragma once
/*
File: Types++.h
Contents: C++ extensions to the Macintosh toolbox.
Version: 3.7 (for System 7.x)
Copyright: ©1995 Chris K. Thomas. All Rights Reserved.
*/
#ifndef COMPILERHAS_BOOL
#define bool int
#endif
#include <Types.h>
#include <TextUtils.h>
#ifdef Assert_
#undef Assert_
#endif /*Assert_*/
#ifdef Throw_
#undef Throw_
#endif /*Throw_*/
#define DEBUGSTR(x) DebugStr("\p" x); //comment for non-debug behavior
#define Assert_(x) if(!(x)) DEBUGSTR("\pAssertion failure: " #x)
#define Throw_(x) do{DEBUGSTR("\pThrowing: " #x); throw x;}while(false)
#define check(x) Assert_(x);
#define require(x, y) do {if(!(x)) {DEBUGSTR("\p" #y); goto y;}} while(false)
#define require_action(x, y, action) do {if(!(x)) {DEBUGSTR("\p" #y); action; goto y;}}while(false)
// an assert which throws if test is failed.
#define EnforceAssertion_(x) if(!(x)) {DebugStr("\pAssertion failure: " #x); throw 'asrt';}
inline void DebugNum(long num)
{
Str255 value;
NumToString(num, value);
DebugStr(value);
}